export const columnsTitle = (vm, vms) => {
  console.log(vm.pagingInfo, '========vm', vms)
  const columnsList = [
    {
      type: 'index',
      minWidth: 50,
      index: index => index + 1 + (vm.pagingInfo.curr_page - 1) * vm.pagingInfo.page_size,
    },
    { type: 'selection', minWidth: 50 },
    {
      title: 'SKU',
      key: 'sku',
      minWidth: 250,
    },
    {
      title: '产品名称',
      key: 'name',
      minWidth: 300,
    },

    {
      title: '长宽高 & 重量',
      key: 'length',
      minWidth: 150,
      render: (h, row) => {
        const { length, width, height, weight } = row

        let val = ''
        if (length && width && height) {
          val = `${length} * ${width} * ${height} & ${weight}`
        }
        return h('span', val)
      },
    },
    {
      title: '品类',
      key: 'category_name',
      minWidth: 130,
    },

    {
      title: '状态',
      key: 'status',
      minWidth: 100,
      render: (h, row) => {
        let { status } = row

        const types = status == 2 ? 'success' : 'warning'

        if (status == 2) {
          status = '已审核'
        } else if (status == 1) {
          status = '待审核'
        } else {
          status = ''
        }

        return h(
          'el-tag',
          {
            attrs: {
              type: types,
              effect: 'dark',
            },
          },
          status,
        )
      },
    },

    {
      title: '创建时间',
      key: 'create_time',
      minWidth: 130,
      hide: true,
    },
    {
      key: 'update_time',
      title: '更新时间',
      minWidth: 150,
      hide: true,
    },
    {
      key: 'customs_desc',
      title: '描述',
      minWidth: 150,
      hide: true,
    },
  ]

  console.log(columnsList, 'columnsList')
  return columnsList
}
